﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace DreamBox.Admin.User
{
    public partial class GroupList : BLL.BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DAL.PSelect ps = new DAL.PSelect();
                RepeaterList.DataSource = ps.Select("dbox_UserGroup","*","");
                RepeaterList.DataBind();
            }
        }
        protected void LinkBtnDelete_Click(object sender, EventArgs e)
        {
            LinkButton linkBtn=sender as LinkButton;
            int GID = int.Parse(linkBtn.ToolTip);
            if (GID != -1 && GID != 0 && GID != 1)
            {
                DAL.Admin.UserGroup group = new DAL.Admin.UserGroup();
                if (group.Delete(GID))
                {
                    BLL.Admin.Tips.DetailedTips(this, "删除成功", "/User/GroupList.aspx", "1");
                }
            }
            else
            {
                BLL.Admin.Tips.DetailedTips(this, "系统默认用户组不允许删除", "/User/GroupList.aspx", "0");
            }
        }
    }
}